//
//  goodPointCell.m
//  SSSAllRollAgency
//
//  Created by Darker on 2017/3/16.
//  Copyright © 2017年 Darker. All rights reserved.
//

#import "goodPointCell.h"
#import "goodModel.h"

@implementation goodPointCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = [UIColor clearColor];
        //初始化子视图
        [self initSubsView];
    }
    return self;
}
- (void)initSubsView{
    
    UIView *centerView1 = [[UIView alloc]init];
    [self.contentView addSubview:centerView1];
    centerView1.sd_layout
    .leftSpaceToView(self.contentView,WidthIos6CompeteWithCurrent(20))
    .centerYEqualToView(self.contentView)
    .heightIs(HeigthIos6CompeteWithCurrent(30))
    .widthIs(WidthIos6CompeteWithCurrent(80));
    
    _timeLabel = [[UILabel alloc]init];
    _timeLabel.textAlignment = NSTextAlignmentCenter;
    _timeLabel.text = @"2017-03-09";
    _timeLabel.textColor = [UIColor colorWithHex:@"6D6D6D"];
    _timeLabel.font = [SSSFont systemFontOfSize:12];
    [centerView1 addSubview:_timeLabel];
    _timeLabel.sd_layout
    .topEqualToView(centerView1)
    .leftEqualToView(centerView1)
    .rightEqualToView(centerView1)
    .heightIs(centerView1.frame.size.height/2);
    
    _descTimeLabel = [[UILabel alloc]init];
    _descTimeLabel.text = @"21:47:54";
    _descTimeLabel.textColor = [UIColor colorWithHex:@"6D6D6D"];
    _descTimeLabel.font = [SSSFont systemFontOfSize:12];
    _descTimeLabel.textAlignment = NSTextAlignmentCenter;
    [centerView1 addSubview:_descTimeLabel];
    _descTimeLabel.sd_layout
    .topSpaceToView(_timeLabel,0)
    .leftEqualToView(centerView1)
    .rightEqualToView(centerView1)
    .bottomEqualToView(centerView1);
    
    
    //提现
    UIView *centerView2 = [[UIView alloc]init];
    [self.contentView addSubview:centerView2];
    centerView2.sd_layout
    .leftSpaceToView(self.contentView,WidthIos6CompeteWithCurrent(160))
    .centerYEqualToView(self.contentView)
    .heightIs(HeigthIos6CompeteWithCurrent(30))
    .widthIs(WidthIos6CompeteWithCurrent(70));
    
    UILabel *tiLabel = [[UILabel alloc]init];
    tiLabel.text = @"提现";
    tiLabel.textColor = [UIColor colorWithHex:@"6D6D6D"];
    tiLabel.font = [SSSFont systemFontOfSize:12];
    tiLabel.textAlignment = NSTextAlignmentCenter;
    [centerView2 addSubview:tiLabel];
    tiLabel.sd_layout
    .topEqualToView(centerView2)
    .leftEqualToView(centerView2)
    .rightEqualToView(centerView2)
    .heightIs(centerView2.frame.size.height/2);
    
    _nuLabel = [[UILabel alloc]init];
    _nuLabel.text = @"-10000";
    _nuLabel.textColor = [UIColor colorWithHex:@"6D6D6D"];
    _nuLabel.font = [SSSFont systemFontOfSize:12];
    _nuLabel.textAlignment = NSTextAlignmentCenter;
    [centerView2 addSubview:_nuLabel];
    _nuLabel.sd_layout
    .topSpaceToView(tiLabel,0)
    .leftEqualToView(centerView2)
    .rightEqualToView(centerView2)
    .bottomEqualToView(centerView2);
    
    _surplusNuLabel = [[UILabel alloc]init];
    _surplusNuLabel.text = @"20000";
    _surplusNuLabel.textAlignment = NSTextAlignmentCenter;
    _surplusNuLabel.textColor = [UIColor colorWithHex:@"6D6D6D"];
    _surplusNuLabel.font = [SSSFont systemFontOfSize:12];
    [self.contentView addSubview:_surplusNuLabel];
    _surplusNuLabel.sd_layout
    .centerYEqualToView(self.contentView)
    .rightSpaceToView(self.contentView,WidthIos6CompeteWithCurrent(0))
    .heightIs(HeigthIos6CompeteWithCurrent(10))
    .widthIs(WidthIos6CompeteWithCurrent(100));
    //.widthIs(WidthIos6CompeteWithCurrent([ZDKitManager zd_AutoSizeOfWidthWithText:_surplusNuLabel.text font:_surplusNuLabel.font height:HeigthIos6CompeteWithCurrent(10)]));
    
    self.lineView = [[UIView alloc]init];
    self.lineView.backgroundColor = [UIColor colorWithHex:@"E5E5E8"];
    [self.contentView addSubview:self.lineView];
    self.lineView.sd_layout
    .leftEqualToView(self.contentView)
    .rightEqualToView(self.contentView)
    .bottomEqualToView(self.contentView)
    .heightIs(HeigthIos6CompeteWithCurrent(1));
}
- (void)setModel:(goodModel *)model{
    
    _model = model;
    if ([NSString stringWithFormat:@"%@",model.bdsj].length<=0) {
        
        self.timeLabel.text = @"";
        _descTimeLabel.text = @"";
    }else{
        
        //        subStr = [model.bdsj substringWithRange:NSMakeRange(0,model.bdsj.length - 3)];
        //        self.timeLabel.text = [NSString timeDateStrFromTimeStamp:subStr];
        self.timeLabel.text = [model.bdsj xhstringWithFormat:@"yyyy-MM-dd"];
        _descTimeLabel.text = [model.bdsj xhstringWithFormat:@"HH:mm:ss"];
    }
    self.nuLabel.text = [NSString stringWithFormat:@"%@",model.bdsz];
    self.surplusNuLabel.text = [NSString stringWithFormat:@"%@",model.jieyu];
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
